export const getParamsCodes = data => {
  const tempMap = {};
  data.forEach(el => {
    if (tempMap[el.attributes.type]) {
      tempMap[el.attributes.type].push(el.code);
    } else {
      tempMap[el.attributes.type] = [el.code];
    }
  });
  const resultMap = {
    ai: '',
    jq: '',
    fk: '',
    xqdw: '',
  };
  Object.keys(resultMap).forEach(k => (resultMap[k] = tempMap[k] ? tempMap[k].toString() : ''));
  return resultMap;
};

export const getParamsNames = data => {
  const tempName = {};
  data.forEach(el => {
    if (tempName[el.attributes.type]) {
      tempName[el.attributes.type].push(el.code);
    } else {
      tempName[el.attributes.type] = [el.code];
    }
  });
  return tempName;
};
